﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DeleteComment : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string commentID = Request.Params["CommentID"];
        string bookID = Request.Params["BookID"];
        LINQDataContext lin = new LINQDataContext();
        var rs = from a in lin.GetTable<Comment>()
                 where a.CommentID.ToString() ==  commentID
                 select a;
        foreach (var item in rs)
        {
            lin.Comments.DeleteOnSubmit(item);
            lin.SubmitChanges();
        }
        Response.Redirect("BookInformation.aspx?BookID=" + bookID);
    }
}